<%@page import="javax.websocket.SendHandler"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
    import="com.vo.*,com.dao.*,com.daoimpl.*,java.util.*"
    pageEncoding="utf-8"%>
    <%@taglib uri="http://jsptags.com/tags/navigation/pager" prefix="pg"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>ColorFlames | Contact</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
	<%@ include file="navi.jsp" %>      
    <%-- <%
		//使用pager javabean的要求：
		//ArrayList list中存放了所有的新闻户对象
		//list存放在session中
		List<News> list =(List<News>)session.getAttribute("list2");
	    if(list == null){
	    	out.print("请先发布新闻！！");
	    	response.setHeader("Refresh", "2; URL=index.jsp");
	    }else{
	    	for(int i=0;i<list.size();i++){
		    	int id= list.get(i).getId();
		    	String s = list.get(i).getTitle();
		    	String s2 = list.get(i).getType();
		    	out.println("id = "+ id +"标题="+ s +"类型="+ s2);
	    	}
	    }
	%> --%>
	
	<pg:pager maxPageItems="2" url="newsbytype.jsp">
		 <table>
			 <c:forEach items="${sessionScope.newsList}" var="news">
				 <pg:item>
					 <tr> 
					 	<td><a href="shownewsbyid.jsp?id=${news.id}">${news.title}</a></td>
					 	<td><a href="DeleteNewsByIdServlet?id=${news.id}">删除新闻</a></td>
					 </tr>
					 <tr> 
					 	<td><span class="blogtime">${news.datetime}</span></td> 
					 </tr>
				 </pg:item>
			 </c:forEach>
			 <tr>
				 <td  >
					 <pg:index>
					 <pg:first><a href="${pageUrl }">第一页</a></pg:first>
					 <pg:prev><a href="${pageUrl}">上一页</a></pg:prev>
					 <pg:pages>
					 <a href="${pageUrl}">[${pageNumber }]</a>
					 </pg:pages>
					 <pg:next><a href="${pageUrl}">下一页</a></pg:next>
					 <pg:last><a href="${pageUrl }">最后一页</a></pg:last>
					 </pg:index>
				 </td>
			 </tr>
		</table>
	</pg:pager>
	
	<!--main end-->
	<%@ include file="foot.jsp" %>
</body>
</html>
